const constants = {
  ERRORS: {
    // 授权模板错误
    ERR_HEADER_MISSED: 'ERR_HEADER_MISSED',
    ERR_GET_SESSION_KEY: 'ERR_GET_SESSION_KEY',
    ERR_IN_DECRYPT_DATA: 'ERR_IN_DECRYPT_DATA',
    ERR_SKEY_INVALID: 'ERR_SKEY_INVALID',
    ERR_INVALID_PARAMETER: 'ERR_INVALID_PARAMETER',
    ERR_NO_PROGRESS_FOR_OWN_TASK: 'ERR_NO_PROGRESS_FOR_OWN_TASK',
    ERR_NO_AUTH: 'ERR_NO_AUTH',

    // 数据库错误
    DBERR: {
      ERR_RECORD_NOT_FOUND: 'ERR_RECORD_NOT_FOUND',
      ERR_UNAUTHORIZED_OPERATION: 'ERR_UNAUTHORIZED_OPERATION',
      ERR_WHEN_INSERT_TO_DB: 'ERR_WHEN_INSERT_TO_DB',
      ERR_NO_SKEY_ON_CALL_GETUSERINFOFUNCTION:
        'ERR_NO_SKEY_ON_CALL_GETUSERINFOFUNCTION',
      ERR_DUPLICATE_RECORD: 'ERR_DUPLICATE_RECORD'
    }
  },

  LOGIN_STATE: {
    SUCCESS: 1, // 登陆成功
    FAILED: 0 // 登录失败
  }
}

global.ERRORS = constants.ERRORS
global.LOGIN_STATE = constants.LOGIN_STATE
global.WECHAT = {}

module.exports = constants
